www.gusucode.com > RQCMS PHP文章管理系统 v2.3PHP源码程序 > RQCMS PHP文章管理系统 v2.3/rqcms_v2.3/rqcms_v2.3/data/plugins/appnowus/appnowus.php
<?php /* Plugin Name: appnowus网址重写 Version: 1.0 Description: 转换旧网站用。 Author: RQ204 Author URL: http://www.rqcms.com */ function appnowus_before_router() { global $page,$view,$coreView,$tempView,$theme,$_GET; //preg_match if(strpos(REQUEST_URI,'list-')!==false) { if(preg_match("/list-(\d+)\.html/i",REQUEST_URI,$arr)) //list-29-3.html list-29.html { $_GET['url1']=$arr[1]; } else if(preg_match("/list-(\d+)-(\d+)\.html/i",REQUEST_URI,$arr)) //list-29-3.html list-29.html { $_GET['url1']=$arr[1]; $page=$arr[2]; } if($arr) { $views='category.php'; $coreView=RQ_CORE.'/'.$views;//核心处理文件 $tempView=RQ_DATA.'/themes/'.$theme.'/'.$views;//风格模板文件 } } else if(strpos(REQUEST_URI,'Games')!==false)//http://www.appnow.me/Games/Pixel-Gun-3D-292604.html { $urlarr=explode(REQUEST_URI,'/'); if(count($urlarr)==2&&endsWith($url[1],'.html')) { $_GET['url1']=substr($urlarr[1],0,-5); $views='article.php'; $coreView=RQ_CORE.'/'.$views;//核心处理文件 $tempView=RQ_DATA.'/themes/'.$theme.'/'.$views;//风格模板文件 } } } function endsWith($haystack, $needle) { $length = strlen($needle); if ($length == 0) { return true; } return (substr($haystack, -$length) === $needle); } addAction('before_router','appnowus_before_router');